Population class extension: slurm module
Module containing the Slurm functions for the binarycpython package.
This class object is an extension to the population grid object
- class binarycpython.utils.population_extensions.slurm.slurm(**kwargs)[source]
Bases:
object
Extension for the Population class containing the code for Slurm grid simulations
- get_slurm_status(jobid=None, jobarrayindex=None, slurm_dir=None)[source]
Get and return the slurm status string corresponing to the self object, or jobid.jobarrayindex if they are passed in. If no status is found, returns an empty string.
- set_slurm_status(string, slurm_dir=None)[source]
Set the slurm status corresponing to the self object, which should have slurm_jobid and slurm_jobarrayindex set.
- Parameters
string – the status string to be set
slurm_dir – the directory in which the status directory is held. If not set, this defaults to the HPC directory (e.g. slurm_dir or condor_dir).
- slurmID(jobid=None, jobarrayindex=None)[source]
Function to return a Slurm job ID as a string, [jobid].[jobarrayindex]. The jobid and jobarrayindex passed in are used if given, otherwise we default to the jobid and jobarrayindex in population_options.
- slurm_check_requirements()[source]
Function to check whether the slurm parameters in population_options have been set appropriately.
- slurm_grid()[source]
function to be called when running grids when population_options[‘slurm’]>=1
if population_options[‘slurm’]==1, we set up the slurm script and launch the jobs, then return True to exit. if population_options[‘slurm’]==2, we run the stars, which means we return False to continue. if population_options[‘slurm’]==3, we are being called from the jobs to run the grids, return False to continue.
TODO: split this function into some parts TODO: Comment this function better